keymap = Array();
keymap['o'] = 'অ';
keymap['a'] = 'আ';
keymap['A'] = 'আ';
keymap['i'] = 'ই';
keymap['I'] = 'ঈ';
keymap['u'] = 'উ';
keymap['U'] = 'ঊ';
keymap['e'] = 'এ';
keymap['E'] = 'ঐ';
keymap['O'] = 'ও';
keymap['w'] = 'ঔ';
keymap['q'] = 'ঋ';
keymap['omatra'] = '';
keymap['amatra'] = 'া';
keymap['Amatra'] = 'া';
keymap['imatra'] = 'ি';
keymap['Imatra'] = 'ী';
keymap['umatra'] = 'ু';
keymap['Umatra'] = 'ূ';
keymap['ematra'] = 'ে';
keymap['Ematra'] = 'ৈ';
keymap['Omatra'] = 'ো';
keymap['wmatra'] = 'ৌ';
keymap['qmatra'] = 'ৃ';
keymap['hasanta'] = '্';
keymap['k'] = 'ক';
keymap['kh'] = 'খ';
keymap['g'] = 'গ';
keymap['gh'] = 'ঘ';
keymap['Ng'] = 'ঙ';
keymap['G'] = 'ঙ';
keymap['c'] = 'চ';
keymap['ch'] = 'ছ';
keymap['j'] = 'জ';
keymap['jh'] = 'ঝ';
keymap['NG'] = 'ঞ';
keymap['J'] = 'ঞ';
keymap['t'] = 'ত';
keymap['th'] = 'থ';
keymap['d'] = 'দ';
keymap['dh'] = 'ধ';
keymap['n'] = 'ন';
keymap['T'] = 'ট';
keymap['Th'] = 'ঠ';
keymap['D'] = 'ড';
keymap['Dh'] = 'ঢ';
keymap['N'] = 'ণ';
keymap['p'] = 'প';
keymap['ph'] = 'ফ';
keymap['b'] = 'ব';
keymap['bh'] = 'ভ';
keymap['m'] = 'ম';
keymap['z'] = 'য';
keymap['Y'] = 'য';
keymap['y'] = 'য়';
keymap['r'] = 'র';
keymap['l'] = 'ল';
keymap['sh'] = 'শ';
keymap['S'] = 'ষ';
keymap['s'] = 'স';
keymap['H'] = 'হ';
keymap['h'] = 'হ';
keymap['R'] = 'ড়';
keymap['Rh'] = 'ঢ়';
keymap['Tt'] = 'ৎ';
keymap['ng'] = 'ং';
keymap['ks'] = 'ক্স';
keymap['x'] = 'ক্স';
keymap['kS'] = 'ক্ষ';
keymap['rY'] = 'র‍্য';
keymap[':'] = 'ঃ';
keymap['C'] = 'ঁ';
keymap['.'] = '।';
keymap['+'] = '';
keymap['#'] = '‌';
keymap['`'] = '‌';

function mreplace(s,a,b){if(a=='^')s=s.replace(/\^/g,b);else if(s.indexOf(a)>-1)s=s.replace(new RegExp(a,'g'),b);return s}
function process(){intext=self.document.getElementById('textInput').value;
outEl=self.document.getElementById('status');
outEl.value='';
intext=mreplace(intext,'KeyMap','কিম্যাপ');
intext=mreplace(intext,'oo','O');
intext=mreplace(intext,'OU','w');
intext=mreplace(intext,'OI','E');
intext=mreplace(intext,'Tt','ৎ');
intext=mreplace(intext,'B','b');
intext=mreplace(intext,'F','ph');
intext=mreplace(intext,'K','k');
intext=mreplace(intext,'L','l');
intext=mreplace(intext,'M','m');
intext=mreplace(intext,'P','p');
intext=mreplace(intext,'Q','q');
intext=mreplace(intext,'V','bh');
intext=mreplace(intext,'X','x');
intext=mreplace(intext,'W','w');
intext=mreplace(intext,'Z','z');
intext=mreplace(intext,'ii','I');
intext=mreplace(intext,'ee','I');
intext=mreplace(intext,'uu','U');
intext=mreplace(intext,'rri','q');
intext=mreplace(intext,'Ng','G');
intext=mreplace(intext,'NG','J');
intext=mreplace(intext,'f','ph');
intext=mreplace(intext,'v','bh');
intext=mreplace(intext,'Sh','S');
intext=mreplace(intext,'ng','ং');
intext=mreplace(intext,':','ঃ');
intext=mreplace(intext,'b ','bo ');
intext=mreplace(intext,'c ','co ');
intext=mreplace(intext,'d ','do ');
intext=mreplace(intext,'f ','fo ');
intext=mreplace(intext,'g ','go ');
intext=mreplace(intext,'h ','ho ');
intext=mreplace(intext,'j ','jo ');
intext=mreplace(intext,'k ','ko ');
intext=mreplace(intext,'l ','lo ');
intext=mreplace(intext,'m ','mo ');
intext=mreplace(intext,'n ','no ');
intext=mreplace(intext,'p ','po ');
intext=mreplace(intext,'r ','ro ');
intext=mreplace(intext,'s ','so ');
intext=mreplace(intext,'t ','to ');
intext=mreplace(intext,'v ','vo ');
intext=mreplace(intext,'Y ','Yo ');
intext=mreplace(intext,'Z ','Zo ');
intext=mreplace(intext,'R ','Ro ');
intext=mreplace(intext,'D ','Do ');
intext=mreplace(intext,'G ','Go ');
intext=mreplace(intext,'J ','Jo ');
intext=mreplace(intext,'N ','No ');
intext=mreplace(intext,'S ','So ');
intext=mreplace(intext,'T ','To ');
intext=mreplace(intext,'y ','yo ');
intext=mreplace(intext,'0','০');
intext=mreplace(intext,'1','১');
intext=mreplace(intext,'2','২');
intext=mreplace(intext,'3','৩');
intext=mreplace(intext,'4','৪');
intext=mreplace(intext,'5','৫');
intext=mreplace(intext,'6','৬');
intext=mreplace(intext,'7','৭');
intext=mreplace(intext,'8','৮');
intext=mreplace(intext,'9','৯');
intext=mreplace(intext,'_','');
var i=0;
var a=intext.length;
var b;
var c;
var d;
while(i<a){var b=intext.charAt(i);
if(i+1<a){c=intext.charAt(i+1)}else{c=''}d=b+c;
if(b=='a'||b=='A'||b=='i'||b=='I'||b=='u'||b=='U'||b=='e'||b=='E'||b=='o'||b=='O'||b=='q'||b=='ng'||b==':'||b=='C'||b=='.'||b=='#'||b=='+'||b=='w'||b=='`'||b=='^'){outEl.value+=keymap[b];
i++}else if(b=='k'||b=='g'||b=='G'||b=='c'||b=='j'||b=='J'||b=='t'||b=='d'||b=='n'||b=='T'||b=='D'||b=='N'||b=='p'||b=='b'||b=='m'||b=='s'||b=='h'||b=='z'||b=='r'||b=='l'||b=='G'||b=='Y'||b=='y'||b=='S'||b=='Tt'||b=='H'||b=='R'||b=='Rh'||b=='x'||b=='ks'||b=='ks'){if(d=='kh'||d=='gh'||d=='ch'||d=='jh'||d=='th'||d=='dh'||d=='Th'||d=='Dh'||d=='ph'||d=='bh'||d=='ks'||d=='sh'||d=='Rh'||d=='rY'){b=d;
i++;
if(i+1<a)c=intext.charAt(i+1);
else c=''}if(c=='a'||c=='A'||c=='i'||c=='I'||c=='u'||c=='U'||c=='e'||c=='E'||c=='o'||c=='O'||c=='q'||c=='w'){outEl.value+=(keymap[b]+keymap[c+'matra']);
i+=2}else if(c!=''){outEl.value+=(keymap[b]+keymap['hasanta']);
i+=1}else{outEl.value+=keymap[b];
i+=1}}else if(b=='aY'){outEl.value+='অ্যা';
i+=1}else{outEl.value+=b;
i++}}return outEl.value}